Skip to content

Fix @overload decorator lines classified as Unanalyzed in lineprecision report#21642

Open
nsoulat wants to merge 2 commits into
python:masterfrom
nsoulat:fix-overload-lineprecision-report
Open

Fix @overload decorator lines classified as Unanalyzed in lineprecision report#21642
nsoulat wants to merge 2 commits into
python:masterfrom
nsoulat:fix-overload-lineprecision-report

Conversation

@nsoulat

@nsoulat nsoulat commented Jun 24, 2026

Copy link
Copy Markdown

Fixes #21638.

This is my first contribution PR to mypy.

As explained in the issue, @overload lines are classified as unanalyzed, which is fixed here with StatisticsVisitor now considering OVERLOAD_NAMES to be precise when in a typed scope.

…on report

`@overload` is intentionally absent from the typemap, causing
`StatisticsVisitor` to record `TYPE_UNANALYZED` for every decorator line.
Route `OVERLOAD_NAMES` through `record_precise_if_checked_scope` and exempt
them from its typemap guard.

Fixes python#21638.
@nsoulat nsoulat force-pushed the fix-overload-lineprecision-report branch from 276f05c to 03afa62 Compare June 24, 2026 11:06
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overload decorator lines classified as Unanalyzed

1 participant